﻿<UserControl x:Class="Microsoft.Telco.Controls.WindowsPhone.ReceivedMessagesList"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:converters="clr-namespace:Microsoft.Telco.Controls.WindowsPhone.Converters">
    <UserControl.Resources>
        <converters:EmptyToDefaultPathConverter x:Key="EmptyToDefaultConverter" />
        <converters:MessageTextConverter x:Key="MessageTextConverter" />
        <converters:MessageDateTimeConverter x:Key="MessageDateTimeConverter" />
    </UserControl.Resources>
    <Grid>
        <StackPanel Orientation="Vertical">
            <TextBlock Text="Messages"
                       FontWeight="Bold"
                       Foreground="Black"
                       FontFamily="Arial"
                       FontSize="17"
                       Margin="0,0,0,2"></TextBlock>
            <ListBox x:Name="ListReceivedMessages"
                     ItemsSource="{Binding}" BorderBrush="Gray" BorderThickness="1">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <Grid Width="290"
                              MouseLeftButtonUp="Grid_MouseLeftButtonUp">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                                <ColumnDefinition Width="*"></ColumnDefinition>
                                <ColumnDefinition Width="Auto"></ColumnDefinition>
                            </Grid.ColumnDefinitions>
                            <Image HorizontalAlignment="Center"
                                   VerticalAlignment="Center"
                                   Source="{Binding ImageSource, Converter={StaticResource EmptyToDefaultConverter}}"
                                   Grid.Column="0"
                                   Margin="0"></Image>
                            <TextBlock x:Name="MessageFromTextBlock" Text="{Binding From}"
                                   Grid.Column="0"
                                   Visibility="Collapsed"
                                       Foreground="Black"
                                       FontFamily="Arial"
                                       FontSize="15"
                                   Margin="0"></TextBlock>
                            <TextBlock Text="{Binding Message, Converter={StaticResource MessageTextConverter}}"
                                       Grid.Column="1"
                                       x:Name="tbMessage"
                                       Foreground="Black"
                                       FontFamily="Arial"
                                       FontSize="15"
                                       TextWrapping="Wrap"
                                       Margin="5,0,5,0"></TextBlock>
                            <TextBlock x:Name="FullMessageTextBlock"
                                   Text="{Binding Message}"
                                   Visibility="Collapsed"
                                   Grid.Column="1"></TextBlock>
                            <TextBlock x:Name="MessageDataTimeTextBlock"
                                       Foreground="Black"
                                       FontFamily="Arial"
                                       FontSize="15"
                                       Text="{Binding DateTime, Converter={StaticResource MessageDateTimeConverter}}"
                                       Grid.Column="2"></TextBlock>
                        </Grid>
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </StackPanel>


        <Popup x:Name="MessageDetailsPopup">
            <Border BorderThickness="1"
                    Width="300"
                    Padding="5">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1"
                                         StartPoint="0.5,0">
                        <GradientStop Color="#FFE9E9E9"
                                      Offset="1" />
                        <GradientStop Color="#FFE9E9E9" />
                        <GradientStop Color="#FFF7F7F7"
                                      Offset="0.083" />
                    </LinearGradientBrush>
                </Border.Background>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="28" />
                        <RowDefinition Height="20" />
                        <RowDefinition Height="*" />
                        <RowDefinition />
                    </Grid.RowDefinitions>
                    <Border Width="12"
                            Height="12"
                            Grid.Row="0"
                            Cursor="Hand"
                            HorizontalAlignment="Right"
                            VerticalAlignment="Top"
                            MouseLeftButtonDown="Close_MouseLeftButtonDown">
                        <Path Data="M368.13889,11.909722 L370.13867,9.9094505 L374.30371,14.076056 L378.55179,9.9095049 L380.63428,11.909342 L376.38602,16.158936 L380.71805,20.408079 L378.80215,22.741697 L374.38675,18.325535 L370.2215,22.741816 L367.9722,20.491972 L372.3038,16.15906 z"
                              Stretch="Fill"
                              Stroke="Black"
                              StrokeThickness="0"
                              Width="10"
                              Height="10">
                        <Path.Fill>
                            <LinearGradientBrush EndPoint="0.498,0.001"
                                                 StartPoint="0.502,0.999">
                                <GradientStop Color="Black"
                                              Offset="0.437" />
                                <GradientStop Color="#FF969696"
                                              Offset="0.535" />
                            </LinearGradientBrush>
                        </Path.Fill>
                    </Path>
                    </Border>
                    <TextBlock Margin="5"
                               Grid.Row="1"
                               x:Name="MessageSenderNameTextBlock"
                               TextWrapping="Wrap"
                               Text="FirstName LastName is bigger"
                               HorizontalAlignment="Left"
                               FontFamily="Arial"
                               FontSize="20"
                               VerticalAlignment="Center"
                               FontWeight="Bold"
                               Foreground="#FF0066CC" />
                    <TextBlock Margin="5,0,5,5"
                               Grid.Row="2"
                               TextWrapping="Wrap"
                               x:Name="MessageDateTimeTextBlock"
                               Text="Wednesday, 33 Nov 2010 1:45PM"
                               HorizontalAlignment="Left"
                               FontFamily="Arial"
                               VerticalAlignment="Center"
                               Foreground="#FF666666"
                               FontStyle="Italic"
                               FontSize="14" />
                    <TextBlock Margin="5,10,5,5"
                               Grid.Row="3"
                               TextWrapping="Wrap"
                               x:Name="MessageTextBlock"
                               HorizontalAlignment="Left"
                               Foreground="Black"
                               FontFamily="Arial"
                               FontSize="15"></TextBlock>
                </Grid>
            </Border>
        </Popup>
    </Grid>
</UserControl>
